<template>
	<div class="my-product">
		<h3>标题：{{ title }}</h3>
		<p>价格：{{ price }}元</p>
		<p>描述：{{ info }}</p>
		<p>
			<button @click="kanFn">砍一刀</button>
		</p>
	</div>
</template>

<script>
export default {
	props: {
		// 直接写类型
		title: String,
		// 类型加默认值
		price: {
            type: Number,
			default: 20,
		},
		info: {
			type: String,
		},
		index: {
			type: Number,
		},
	},
	data() {
		return {};
	},
    methods: {
        kanFn(){
            this.$emit('subPrice', this.index, 1)
        }
    }
};
</script>

<style scoped>
</style>